program read_write

    implicit none

    real :: x

    write (*, *) "Input your number: "  ! 向控制台输出，write(*,*)等同于print *,
    read (*, *) x                       ! 从键盘读入

    open (unit=1, file='1.dat', status='replace')       ! 打开"1.dat"文件为设备号1
    write (1, *) "This is the number you entered: ", x  ! 向设备号1，输出字符串与变量
    close (1)                                           ! 关闭设备号1

end program read_write
